import { ReactNode } from 'react';

// 导航菜单项
export interface NavigationItem {
  id: string;
  label: string;
  path?: string;
  icon?: string;
  permission?: string;
  children?: NavigationItem[];
  external?: boolean;
  target?: '_blank' | '_self';
  badge?: {
    text: string;
    color: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
  };
  disabled?: boolean;
  hidden?: boolean;
  sort?: number;
}

// 面包屑项
export interface BreadcrumbItem {
  label: string;
  path?: string;
  icon?: string;
  disabled?: boolean;
}

// 路由守卫配置
export interface RouteGuard {
  requireAuth?: boolean;
  permissions?: string[];
  roles?: string[];
  redirect?: string;
  onUnauthorized?: () => void;
}

// 页面元信息
export interface PageMeta {
  title: string;
  description?: string;
  keywords?: string[];
  breadcrumbs?: BreadcrumbItem[];
  permissions?: string[];
  roles?: string[];
  hideInMenu?: boolean;
  keepAlive?: boolean;
  icon?: string;
  badge?: {
    text: string;
    color: string;
  };
}

// 应用路由配置
export interface AppRoute {
  path: string;
  element: ReactNode;
  meta?: PageMeta;
  guard?: RouteGuard;
  children?: AppRoute[];
  index?: boolean;
}

// 侧边栏状态
export interface SidebarState {
  open: boolean;
  collapsed: boolean;
  width: number;
  collapsedWidth: number;
}

// 头部状态
export interface HeaderState {
  height: number;
  fixed: boolean;
  showBreadcrumb: boolean;
  showUserMenu: boolean;
  showNotifications: boolean;
}

// 布局配置
export interface LayoutConfig {
  sidebar: SidebarState;
  header: HeaderState;
  footer: {
    show: boolean;
    height: number;
    fixed: boolean;
  };
  content: {
    maxWidth?: number;
    padding: number;
  };
}

// 通知项
export interface NotificationItem {
  id: string;
  title: string;
  message: string;
  type: 'info' | 'success' | 'warning' | 'error';
  read: boolean;
  avatar?: string;
  link?: string;
  createdAt: string;
  actions?: {
    label: string;
    action: () => void;
  }[];
}

// 用户菜单项
export interface UserMenuItem {
  id: string;
  label: string;
  icon?: string;
  path?: string;
  action?: () => void;
  divider?: boolean;
  hidden?: boolean;
  disabled?: boolean;
}

// 快捷操作
export interface QuickAction {
  id: string;
  label: string;
  description?: string;
  icon: string;
  path?: string;
  action?: () => void;
  permission?: string;
  color?: string;
  disabled?: boolean;
}

// 搜索结果项
export interface SearchResultItem {
  id: string;
  title: string;
  description?: string;
  type: 'page' | 'user' | 'tenant' | 'organization' | 'document';
  path?: string;
  icon?: string;
  matches?: string[]; // 匹配的关键词
  score?: number; // 搜索匹配分数
}

// 全局搜索配置
export interface GlobalSearchConfig {
  enabled: boolean;
  placeholder: string;
  hotkeys: string[];
  maxResults: number;
  searchScopes: {
    id: string;
    label: string;
    enabled: boolean;
  }[];
}